//
//  HJInfoDetailHeader.m
//  project
//
//  Created by hu on 2019/3/23.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJInfoDetailHeader.h"
#import "YFJourneyTagView.h"
#import "YFJourneyModel.h"
@implementation HJInfoDetailHeader

-(void)awakeFromNib {
    [super awakeFromNib];
    self.categryView.layer.cornerRadius = 8;
    self.categryView.layer.masksToBounds = YES;
    self.likeBtn.layer.borderWidth = 1;
    self.likeBtn.layer.borderColor = [UIColor whiteColor].CGColor;
    self.likeBtn.layer.cornerRadius = 15;
    
    self.headImage.layer.borderWidth = 5;
    self.headImage.layer.borderColor = [UIColor whiteColor].CGColor;
    self.headImage.layer.cornerRadius = 35;
    self.headImage.layer.masksToBounds = YES;
}

-(void)loadHeaderData:(YFUserModel *)model {
    [self.headImage sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
    self.name.text = model.nickName;
    self.genderImage.image = [model.sex isEqualToString:@"1"] ? setImage(@"ico_mine_male") : setImage(@"ico_mine_female");
    self.vipImage.hidden = !model.vip;
    self.cerficationImage.hidden = !model.auth;
    self.signature.text = [NSString stringWithFormat:@"签名：%@",model.intro];
    
    self.yearLabel.text = [NSString stringWithFormat:@"%@岁",model.age];
    self.city.text = model.cityModel.cityName;
    self.emotion.text = model.emotion;
    // tags标签
    NSMutableArray * tags = [NSMutableArray array];
    NSMutableArray * colors = [NSMutableArray array];
    for (YFUserInfoTagModel * tagModel in model.tagModels) {
        [tags addObject:tagModel.name];
        [colors addObject:[UIColor withHexString:tagModel.color]];
    }
    [self.labelView addSubview:[[YFJourneyTagView alloc]initWithFrame:self.labelView.bounds tags:tags colors:colors]];
}

- (IBAction)likeTaBtnClicked:(UIButton *)sender {
    
}
@end
